﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Register.aspx.cs" Inherits="Weixin.Web.Register" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no"" />
    <title>中国税务咨询师</title>
    <link rel="stylesheet" href="Styles/jquery.mobile-1.3.2.min.css" />
    <script type="text/javascript" src="Scripts/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="Scripts/jquery.mobile-1.3.2.min.js"></script>
    <link rel="stylesheet" href="Styles/css.css" />
    <script type="text/javascript">
        function Chk() {
            $(".err").each(function () {
                $(this).removeClass("err");
            })

            if ($("#txtEmail").val() == "") {
                $("#txtEmail").addClass("err");
                return false;
            }
            if (!isPhone($("#txtEmail").val()) && !isMail($("#txtEmail").val())) {
                $("#txtEmail").addClass("err");
                return false;
            }
            if ($("#txtPassword").val() == "") {
                $("#txtPassword").addClass("err");
                return false;
            }
            if ($("#txtPassword").val() != $("#txtPassword2").val()) {
                $("#txtPassword2").addClass("err");
                return false;
            }
            if ($("#txtRecommandUser").val() == "") {
                $("#txtRecommandUser").addClass("err");
                return false;
            }
            if (!isPhone($("#txtRecommandUser").val()) && !isMail($("#txtRecommandUser").val())) {
                $("#txtRecommandUser").addClass("err");
                return false;
            }
            if (isPhone($("#txtEmail").val())) {
                $("#txtMobile").val($("#txtEmail").val());
                $("#txtEmail").val('');
            }

            return true;
        }

        function isPhone(str) {
            var reg = /((\(\d{2,3}\))|(\d{3}\-))?1\d{10}$/;
            return reg.test(str);
        }
        function isMail(str) {
            var pattern = /^([0-9A-Za-z\-_\.]+)@([0-9a-z]+(\.[0-9a-z]+)?(\.[0-9a-z]+)?\.[a-z]{2,3}(\.[a-z]{2})?)$/g;
            if (str != "") {
                if (!pattern.exec(str)) {
                    return false;
                }
            }
            return true;
        }
    </script>
</head>
<body>
    <form id="form1" runat="server" action="?act=save">
    <div data-role="page">
        <div class="content" data-role="content">
            <div>
                <span class="hotline">咨询热线:400-677-1077</span><img src="images/logo.jpg" />
            </div>
            <div class="sep"></div>
            <h3>
                免费注册</h3>
            <div class="nav"><a href="###">中国税务咨询师</a></div>
            <p>
            <label for="txtCourse">用户名：</label>
            <input type="text" placeholder="请输入手机或邮箱" name="txtEmail" id="txtEmail" runat="server">
            <input type="hidden" name="txtMobile" id="txtMobile" runat="server">
            <label for="txtName">密码：</label>
            <input type="password" placeholder="请输入密码" name="txtPassword" id="txtPassword">
            <label for="txtMobile">确认密码：</label>
            <input type="password" placeholder="请再次输入密码" name="txtPassword2" id="txtPassword2">
            <label for="txtEmail">推荐人：</label>
            <input type="text" placeholder="请输入推荐人手机或者邮箱" name="txtRecommandUser" id="txtRecommandUser">
            <button data-theme="b" onclick="return Chk();">提交</button>
            </p>
        </div>
    </div>
    </form>
    <script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
    <script type="text/javascript">
        wx.config({
            debug: false,
            appId: 'wx703bdad593d1756d',
            timestamp: <%=timestamp %>,
            nonceStr: '<%=noncestr %>',
            signature: '<%=signature %>',
            jsApiList: ['onMenuShareTimeline','onMenuShareAppMessage','onMenuShareQQ','onMenuShareWeibo']
        });
    </script>
    <script type="text/javascript">
        wx.ready(function () {
            //wx.hideOptionMenu();
            wx.onMenuShareTimeline({
                title: '<%=title %>',
                link: '<%=url %>',
                imgUrl: 'http://wx.china-tax.org/images/logo2.jpg',
                trigger: function (res) {
                    //alert('用户点击分享到朋友圈');
                },
                success: function (res) {
                    //alert('已分享');
                },
                cancel: function (res) {
                    //alert('已取消');
                },
                fail: function (res) {
                    alert(JSON.stringify(res));
                }
            });
            wx.onMenuShareAppMessage({
                title: '<%=title %>',
                desc: '<%=desc %>',
                link: '<%=url %>',
                imgUrl: 'http://wx.china-tax.org/images/logo2.jpg',
                type: 'link',
                dataUrl: '',
                trigger: function (res) {
                    //alert('用户点击发送给朋友');
                },
                success: function (res) {
                    //alert('已分享');
                },
                cancel: function (res) {
                    //alert('已取消');
                },
                fail: function (res) {
                    alert(JSON.stringify(res));
                }
            });
            wx.onMenuShareQQ({
                title: '<%=title %>', // 分享标题
                desc: '<%=desc %>', // 分享描述
                link: '<%=url %>', // 分享链接
                imgUrl: 'http://wx.china-tax.org/images/logo2.jpg', // 分享图标
                success: function () {
                    //alert('已分享');
                },
                cancel: function () {
                    // 用户取消分享后执行的回调函数
                }
            });
            wx.onMenuShareWeibo({
                title: '<%=title %>', // 分享标题
                desc: '<%=title %>', // 分享描述
                link: '<%=url %>', // 分享链接
                imgUrl: 'http://wx.china-tax.org/images/logo2.jpg', // 分享图标
                success: function () {
                    //alert('已分享');
                },
                cancel: function () {
                    // 用户取消分享后执行的回调函数
                }
            });
        });
    </script>
</body>
</html>
